<html><head><title>Perform advanced crosses</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<link rel="stylesheet" type="text/css" href="Rchm.css">
</head>
<body>

<table width="100%"><tr><td>crossLGS(LGS)</td><td align="right">R Documentation</td></tr></table><object type="application/x-oleobject" classid="clsid:1e2a7bd0-dab9-11d0-b93a-00c04fc99f9e">
<param name="keyword" value="R:   crossLGS">
<param name="keyword" value=" Perform advanced crosses">
</object>


<h2>Perform advanced crosses</h2>


<h3>Description</h3>

<p>
<code>crossLGS</code> uses <code><a href="simLGS.html">simLGS</a></code> to simulate several generations of backcrossing and selfing. Different mating ststems are available.
</p>


<h3>Usage</h3>

<pre>
crossLGS(cross= "self", generations= 0, ...)
</pre>


<h3>Arguments</h3>

<table summary="R argblock">
<tr valign="top"><td><code>cross</code></td>
<td>
The type of experimental cross to simulate (see <code>Details</code>)</td></tr>
<tr valign="top"><td><code>generations</code></td>
<td>
Number of advanced generations to be simulated in addition to the first cross </td></tr>
<tr valign="top"><td><code>...</code></td>
<td>
Arguments to be passed to <code><a href="simLGS.html">simLGS</a></code></td></tr>
</table>

<h3>Details</h3>

<p>
<code>crossLGS</code> collects the selected population of <code><a href="simLGS.html">simLGS</a></code> (<code>simLGS$selPop</code>) and mates it with itself or with a parental pure strain. In each case, mating occurs at random.
</p>
<p>
The type of advanced cross is specified in <code>cross</code> and should be one of: <code>"self"</code> to perform random mating of the population; <code>"bcR"</code> or <code>"bcS"</code> to backcross the selected population to a population of resistant or susceptible parents respectively.
</p>
<p>
<code>generations</code> specifies how many rounds of mating and selection should be performed after the first mating. Note that the default, zero, implies a single event of mating and selection and it is therefore equivalent to simply using <code><a href="simLGS.html">simLGS</a></code>.
</p>
<p>
The arguments to be passed to <code><a href="simLGS.html">simLGS</a></code> should include at least the map file (<code>map</code> argument), the number of offspring desired before or after selection (<code>offspring</code>), and a scenario of selection (<code>scenario</code>, a column name or index in the map file).
</p>


<h3>Value</h3>

<p>
A list with components:
</p>
<table summary="R argblock">
<tr valign="top"><td><code>recPop</code></td>
<td>
The recombinant population at the end of the cycles of crosses but before last selection is applied. </td></tr>
<tr valign="top"><td><code>ParPop</code></td>
<td>
Parental population used for the last cross. </td></tr>
<tr valign="top"><td><code>selPop</code></td>
<td>
The <code>recPop</code> after the last round of selection</td></tr>
<tr valign="top"><td><code>ChrMap</code></td>
<td>
The original map file with additional columns. Each additional column contains the allele ratios after each cycle of cross and selection. These are named: <code>'gen0'</code> for the first mating, then <code>'gen1'</code>, <code>'gen2'</code> etc. for the advanced crosses</td></tr>
</table>

<h3>Author(s)</h3>

<p>
Dario Beraldi &lt;<a href="mailto:dario.beraldi@ed.ac.uk">dario.beraldi@ed.ac.uk</a>&gt;
</p>


<h3>Examples</h3>

<pre>
#Load the example map file
data(pcMap)
#Let's imagine a cross bewteen two strains, one resistant to a drug 
#and the other susceptible. Resistance is confered by a single locus 
#and no other loci are under selection.
#The susceptible allele has 99

#Five generations of backcrossing to the susceptible strain are simulated:
exp1&lt;- crossLGS(cross="bcS", generations=5, map=pcMap, 
       offspring= 100, scenario= "EqualFitness99",
       gen.dist="phy")
bc&lt;- exp1$ChrMap # Put map and allele ratios in 'bc' for convenience

#Plot the allele ratios of the first cross (gen0), third backcross (gen3),
#and fifth backcross (gen5)
plotLGS(cumDist=bc$CumDist, chr=bc$Chr, allRatio=bc$gen0, show.range=FALSE)
plotLGS(cumDist=bc$CumDist, chr=bc$Chr, allRatio=bc$gen3, col="red", add=TRUE)
plotLGS(cumDist=bc$CumDist, chr=bc$Chr, allRatio=bc$gen5, col="blue", add=TRUE)

#Calculate the baseline (genome-wide mean of the allele ratios), for each generation,
#i.e. first mating plus five backcrosses (allele ratios are in columns 13 to 18)
(gwar&lt;- apply(bc[, 13:18],2, mean))

#Find the allele ratio at the selected locus and the difference with the baseline
#i.e. the depth of the selection valley
(m46&lt;- bc[bc$Locus=="m46", 13:18])
(depth&lt;- 1-(gwar-m46))

#...and plot it
plot(1:6, depth, xaxt="n", xlab="", ylab="Depth of selection valley", ylim=c(0,1),
     main="Effect of advanced backcrossing")
axis(at= 1:6, labels= c("F 1", paste("bc", 1:5)), side=1)
</pre>



<hr><div align="center">[Package <em>LGS</em> version 0.9 <a href="00Index.html">Index]</a></div>

</body></html>
